﻿namespace USElections.Model
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Linq;

    public class CalendarItems : Collection<CalendarItem>
    {
        #region Public properties
        public IEnumerable<CalendarItem> NextItemsOnTheCalendar
        {
            get
            {
                DateTime now = DateTime.Now.Date;

                var first = this.Where(x => x.StartDate.Date >= now).FirstOrDefault<CalendarItem>();

                if (first != null)
                {
                    return this.Where(x => x.StartDate.Date == first.StartDate.Date);
                }

                return null;
            }
        }
        #endregion
    }
}
